authApp.controller("loginController",function($scope,$http,$cookieStore,$cookies){
	$scope.cancellogin=function(){
		var random=Math.random();
		location.href=paths.projectHome+"?random="+random;
	}
	$scope.login=function(){
		if($scope.user!=""&&$scope.password!=""){
			var radom=Math.random();
			$http({
				method:'post',
				url:apis.orguserLogin,
				data:{'account':$scope.user,'password':$scope.password}
			}).success(function(response){
				if(response.code=="000000"){
					$cookies.put('account',$scope.user,{"path":"/"});
					$cookies.put('accounttype','admin',{"path":"/"});

					/*$cookies.put('major',"",{"path":"/"});*/
					$cookies.put('employerName',$scope.user,{"path":"/"});
					location.href=paths.adminHome;
				}else{
					alert(response.errorMsg);
				}
			})
		}
	}
})